package com.androidmvp.dreammvp.simple4;

import com.androidmvp.dreammvp.simple4.base.BasePresenter_4;
import com.androidmvp.local.table.WeatherInfo;

import java.util.List;

import javax.inject.Inject;

/**
 * Presenter 主要起连接 View 和 Dao 的作用
 */
public class MainPresenter_4 extends BasePresenter_4<MainView_4> {

    private MainView_4 mainView;
    public WeatherDao_4 weatherDao =new WeatherDao_4(this);

    @Inject
    public MainPresenter_4(MainView_4 mainView) {
        this.mainView=mainView;

    }
    public void getData(){
        mainView.showProgressBar();
        weatherDao.getData();
    }

    public void loadDataSuccess(List<WeatherInfo> list) {
        mainView.showData(list.get(0));
    }
    public void loadDataFailure(){
        mainView.showData(null);
    }
}
